public class HF_ClientWSContactemail{   
  @future (callout=true)
  public static void AddContactEmail(set<Id> mailset) {
      string outputresult;
      List<Contact_Email__c> mailList = new List<Contact_Email__c>([select Id,Partner_Contact_ID__c,Email_Type_Code__c,Email__c,Preferred_Flag__c,Description__c,Name_Id__c from Contact_Email__c where ID In: mailset]); 
      WebServiceFinal4.BasicEndpoint s = new WebServiceFinal4.BasicEndpoint();
      for(Contact_Email__c mal: mailList){
      //Stores email details in EmailsWrapper
            WebServiceFinal2.EmailWrapper e=new WebServiceFinal2.EmailWrapper();
            e.Comments=mal.Description__c;
            e.DataOn=system.DateTime.Now();
            e.Email=mal.Email__c;
            e.EmailType=mal.Email_Type_Code__c;
            if(mal.Name_Id__c!=null){
            e.NameID=Integer.Valueof(mal.Name_Id__c); }  
            e.PartnerContactID=mal.Partner_Contact_ID__c;
            e.PreferredEmail=mal.Preferred_Flag__c;
            e.SfdcEmailID = mal.Id;     
             
        try
        {
             outputresult=s.AddContactEmail(e);
             system.debug('****'+outputresult);
        }
       catch(Exception ex)
          {
            system.debug('output from webservice: '+ex);       
          }
        }       
    } 
    
  @future (callout=true)
  public static void UpdateContactEmail(set<Id> mailset) {
          string outputresult;
          List<Contact_Email__c> mailList = new List<Contact_Email__c>([select Id,Partner_Contact_ID__c,Email_Type_Code__c,Email__c,Name_Id__c,Preferred_Flag__c,Description__c from Contact_Email__c where ID In: mailset]); 
          WebServiceFinal4.BasicEndpoint s = new WebServiceFinal4.BasicEndpoint();
          for(Contact_Email__c mal: mailList){
        
         //Stores email details in EmailsWrapper
                WebServiceFinal2.EmailWrapper e=new WebServiceFinal2.EmailWrapper();
                e.Comments=mal.Description__c;
                e.DataOn=system.DateTime.Now();
                e.Email=mal.Email__c;
                e.EmailType=mal.Email_Type_Code__c;
                if(mal.Name_Id__c!=null){
                e.NameID=Integer.Valueof(mal.Name_Id__c); }
                e.PartnerContactID=mal.Partner_Contact_ID__c;
                e.PreferredEmail=mal.Preferred_Flag__c;
                e.SfdcEmailID = mal.Id;     
             
        try
        {
             outputresult=s.UpdateContactEmail(e);
             system.debug('****'+outputresult);
        }
       catch(Exception ex)
          {
            system.debug('output from webservice: '+ex);       
          }
        }       
    } 
    }